<template>
  <div class="bg-white rounded-lg p-5 h-full flex flex-col">
    <div>
      <div class="font-bold text-lg mb-4">疫苗储存温度记录</div>
      <el-form :inline="true" :model="formData" ref="queryForm" size="small">
        <el-form-item>
          <el-input
            v-model="formData.vaccineName"
            placeholder="疫苗名称"
          ></el-input>
        </el-form-item>
      </el-form>
      <div>
        <el-button type="primary" @click="search">查询</el-button>
        <el-button @click="reset">重置</el-button>
      </div>

      <el-table class="mt-4" :data="dataList" border>
        <el-table-column type="index" label="序号" width="55" align="center">
        </el-table-column>
        <el-table-column prop="vaccineName" label="疫苗名称"> </el-table-column>
        <el-table-column prop="vaccineNo" label="批号"> </el-table-column>
        <el-table-column prop="product" label="疫苗生产单位"> </el-table-column>
        <el-table-column prop="temperature" label="疫苗储存温度">
        </el-table-column>
        <el-table-column prop="product" label="日期"> </el-table-column>
        <el-table-column prop="reportStatus" label="上报状态">
          <template #default="scope">

          <dict-tag :options="dict.type.report_status" :value="scope.row.reportStatus"/>
        </template>
        </el-table-column>

        <el-table-column prop="picUrl" label="储存温度图片">
          <template #default="scope">
            <el-image style="width: 50px; height: 50px" :src="scope.row.picUrl">
            </el-image>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        style="margin-top: 10px; text-align: right"
        :pageSize="pageSize"
        layout="prev, pager, next"
        :page-sizes="[10, 20, 50]"
        :total="total"
        background
        @sizeChange="handleSizeChange"
        @currentChange="handleCurrentChange"
      >
      </el-pagination>
    </div>
    <hr class="mt-auto mb-4" />
    <div class="flex justify-end">
      <el-button type="primary" @click="goBack">返回</el-button>
    </div>
  </div>
</template>

<script>
import { getVaccinesTemperatureListAPI } from "@/api/zhangping/health-care/prevent-vaccinate";

export default {
  dicts:['report_status'],
  data() {
    return {
      formData: {
        pageNum: 1,
        pageSize: 10,
        vaccineName: null,
      },
      dataList: [],
      pageSize: 10,
      total: 1000,
      titleName: null,
    };
  },
  mounted() {
    this.getDataList();
  },
  methods: {
    handleCurrentChange() {},
    handleSizeChange() {},
    reset() {
      this.$refs.queryForm.resetFields();
      this.search();
    },
    async() {},
    search() {
      this.formData.pageNum = 1;
      this.getDataList();
    },
    goBack() {
      this.$router.back();
    },
    getDataList() {
      this.loading = true;

      getVaccinesTemperatureListAPI(this.formData)
        .then((res) => {
          debugger;
          this.dataList = res.rows;
          this.total = res.total;
        })
        .finally(() => {
          this.loading = false;
        });
    },
  },
};
</script>

<style lang="scss" scoped></style>
